package cn.jy.nvr.ftp1;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import cn.jy.nvr.ftp2.SocketThread;

public class ServerSocketListener implements ServletContextListener{
    private SocketThread socketThread;
	@Override
	public void contextDestroyed(ServletContextEvent e) {
		if(socketThread!=null&&socketThread.isInterrupted()){
			socketThread.closeServerSocket();
			socketThread.interrupt();
			
		}
	}

	@Override
	public void contextInitialized(ServletContextEvent e) {
		ServletContext servletContext = e.getServletContext();
		String str=null;
		if(str==null&&socketThread==null){
			//socketThread=new SocketThread(null,servletContext);
			socketThread.start();
		}
	}

}
